Public Class FormPrincipal
    Private WithEvents efectos As New ClaseGolosinaVisual

    Private Sub FormPrincipal_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        e.Cancel = True
        efectos.VentanaWowClose()

    End Sub

    Private Sub FormPrincipal_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
        Me.ResumeLayout()
        Me.TopMost = True
    End Sub

    Private Sub FormPrincipal_HelpRequested(ByVal sender As Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs) Handles Me.HelpRequested
        HP.SetHelpNavigator(Me, HelpNavigator.TopicId)
        If lblTitulo.Text = "PRINCIPAL" Then
            HP.SetHelpKeyword(Me, "1")
        ElseIf lblTitulo.Text = "CATALOGO" Then
            HP.SetHelpKeyword(Me, "22")
        ElseIf lblTitulo.Text = "LECTORES" Then
            HP.SetHelpKeyword(Me, "24")
        ElseIf lblTitulo.Text = "PRESTAMO" Then
            HP.SetHelpKeyword(Me, "16")
        End If
    End Sub
    Private Sub FormPrincipal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        HP.HelpNamespace = My.Settings.cadenaAyuda
        Me.SetStyle(ControlStyles.OptimizedDoubleBuffer Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw, True)
        Me.UpdateStyles()
        efectos.FadeIn(Me)
        panelPrincipalSet()
    End Sub

    Private Sub PaginaPrincipalToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PaginaPrincipalToolStripMenuItem.Click
        panelPrincipalSet()

    End Sub

    Private Sub PrestamoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrestamoToolStripMenuItem.Click
        panelPrestamoSet()
    End Sub

    Private Sub CatalogoToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CatalogoToolStripMenuItem1.Click
        panelCatalogoSet()

    End Sub

    Private Sub LectoresToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LectoresToolStripMenuItem.Click
        panelLectoresSet()
    End Sub

    Private Sub EstadisticasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EstadisticasToolStripMenuItem.Click
        panelEstadisticasSet()
    End Sub

    Private Sub lblPrestamoOpcion1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion1.Click
        'Dim FormPrestamo As New FormPrestamo()
        ''Set the Parent Form of the Child window.
        'FormPrestamo.MdiParent = Me
        ''Display the new form.
        'FormPrestamo.Show()
        prestar()
    End Sub

    Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NuevoLectorToolStripMenuItem.Click
        nuevoLector()
    End Sub

    Private Sub ToolStripMenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModificarLectorToolStripMenuItem.Click
        'ACA MODIFICO LECTOR!!!!!!!!!!!!!!!!
        modificarLector()
    End Sub

    Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EliminarLectorToolStripMenuItem.Click
        eliminarLector()
    End Sub

    Private Sub Label15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblLectoresOpcion3.Click
        panelEstadisticasSet()
    End Sub

    Private Sub Label17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblLectoresOpcion1.Click
        FormCarnet.ShowDialog()
    End Sub

    Private Sub lblPrestamoOpcion2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion2.Click
        devolver()
    End Sub

    Private Sub btnTarea1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTarea1.Click
        panelPrestamoSet()
        prestar()
    End Sub

    Private Sub btnTarea2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTarea2.Click
        panelPrestamoSet()
        devolver()
    End Sub

    Private Sub btnTarea4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTarea4.Click
        panelLectoresSet()
        nuevoLector()
    End Sub

    Private Sub lblPrestamoOpcion3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion3.Click
        prorroga()
    End Sub

    Private Sub lblPrestamoOpcion4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion4.Click
        anulacion()
    End Sub

    Private Sub lblPrestamoOpcion5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion5.Click
        panelEstadisticasSet()
    End Sub

    Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NuevoCatalogoToolStripMenuItem.Click
        nuevoCatalogo()
    End Sub

    Private Sub ModificarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModificarCatalogoToolStripMenuItem.Click
        modificarCatalogo()
    End Sub

    Private Sub EliminarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EliminarCatalogoToolStripMenuItem.Click
        Dim indice As Integer

        indice = dgvPrincipal.CurrentRow.Index
        If (indice <> -1 And dgvPrincipal.Rows(indice).Selected = False) Then
            MsgBox("Debe seleccionar un registro", MsgBoxStyle.Critical, "Error")
        Else
            Dim id As Integer
            Dim tipo As String
            id = Integer.Parse(dgvPrincipal.Rows(indice).Cells(0).Value.ToString)
            tipo = dgvPrincipal.Rows(indice).Cells(3).Value.ToString

            If tipo = "libro" Then
                Dim libro As New ClaseLibro
                libro.Recuperar(id)
                ClaseCatalogo.eliminarCatalogo(libro)
            ElseIf tipo = "revista" Then
                Dim revista As New ClaseRevista
                revista.Recuperar(id)
                ClaseCatalogo.eliminarCatalogo(revista)
            ElseIf tipo = "dvd" Then
                Dim dvd As New ClaseDvd
                dvd.Recuperar(id)
                ClaseCatalogo.eliminarCatalogo(dvd)
            ElseIf tipo = "cd" Then
                Dim cd As New ClaseCd
                cd.Recuperar(id)
                ClaseCatalogo.eliminarCatalogo(cd)
            ElseIf tipo = "ebook" Then
                Dim ebook As New ClaseEbook
                ebook.Recuperar(id)
                ClaseCatalogo.eliminarCatalogo(ebook)
            ElseIf tipo = "otro" Then
                Dim otro As New ClaseOtro
                otro.Recuperar(id)
                ClaseCatalogo.eliminarCatalogo(otro)
            End If
        End If

    End Sub

    Private Sub Label11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblCatalogoOpcion1.Click
        panelEstadisticasSet()
    End Sub

    Private Sub btnTarea3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTarea3.Click
        panelCatalogoSet()
        nuevoCatalogo()
    End Sub

    Private Sub RetrasosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MorososToolStripMenuItem.Click
        morosos()
    End Sub

    Private Sub LecturasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LecturasCatalogoToolStripMenuItem.Click
        lecturas()
    End Sub

    Private Sub lblLectoresOpcion2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblLectoresOpcion2.Click
        FormPromocion.ShowDialog()
    End Sub


    Private Sub lblTarea1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTarea1.Click
        panelPrestamoSet()
        prestar()
    End Sub

    Private Sub lblTarea1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblTarea1.MouseLeave
        lblTarea1.ForeColor = Color.White
    End Sub

    Private Sub lblTarea1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTarea1.MouseMove
        lblTarea1.ForeColor = Color.Coral
    End Sub

    Private Sub lblTarea2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTarea2.Click
        panelPrestamoSet()
        devolver()
    End Sub

    Private Sub lblTarea2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblTarea2.MouseLeave
        lblTarea2.ForeColor = Color.White
    End Sub

    Private Sub lblTarea2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTarea2.MouseMove
        lblTarea2.ForeColor = Color.Coral
    End Sub

    Private Sub lblTarea3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTarea3.Click
        panelCatalogoSet()
        nuevoCatalogo()
    End Sub

    Private Sub lblTarea3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblTarea3.MouseLeave
        lblTarea3.ForeColor = Color.White
    End Sub

    Private Sub lblTarea3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTarea3.MouseMove
        lblTarea3.ForeColor = Color.Coral
    End Sub

    Private Sub lblTarea4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTarea4.Click
        panelLectoresSet()
        nuevoLector()
    End Sub

    Private Sub lblTarea4_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblTarea4.MouseLeave
        lblTarea4.ForeColor = Color.White
    End Sub

    Private Sub lblTarea4_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblTarea4.MouseMove
        lblTarea4.ForeColor = Color.Coral
    End Sub

    Private Sub efectos_formClosed() Handles efectos.formClosed
        Me.Dispose()
    End Sub

    Private Sub FormPrincipal_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus
        'Me.SuspendLayout()
        Me.TopMost = False
    End Sub

    Private Sub dgvPrincipal_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgvPrincipal.SelectionChanged
        mostrarDatosDGV()
    End Sub

    Private Sub AutorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AutorToolStripMenuItem.Click
        FormNuevoAutor.ShowDialog()
    End Sub

    Private Sub FormPrincipal_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Try
            Me.scDer.SplitterDistance = Me.scDer.Height - 142
        Catch ex As Exception
            ex.Message.ToUpper()
        End Try

    End Sub

    Private Sub FormPrincipal_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeEnd
        Me.scDer.SplitterDistance = Me.scDer.Height - 142
    End Sub

    Private Sub lblLectoresOpcion1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLectoresOpcion1.MouseLeave
        Me.lblLectoresOpcion1.ForeColor = Color.White
        Me.lblLectoresOpcion1.Font = New Font(Me.lblLectoresOpcion1.Font, FontStyle.Regular)
    End Sub

    Private Sub lblLectoresOpcion1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblLectoresOpcion1.MouseMove
        Me.lblLectoresOpcion1.ForeColor = Color.Coral
        Me.lblLectoresOpcion1.Font = New Font(Me.lblLectoresOpcion1.Font, FontStyle.Bold)
    End Sub

    Private Sub lblLectoresOpcion2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLectoresOpcion2.MouseLeave
        Me.lblLectoresOpcion2.ForeColor = Color.White
        Me.lblLectoresOpcion2.Font = New Font(Me.lblLectoresOpcion2.Font, FontStyle.Regular)
    End Sub

    Private Sub lblLectoresOpcion2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblLectoresOpcion2.MouseMove
        Me.lblLectoresOpcion2.ForeColor = Color.Coral
        Me.lblLectoresOpcion2.Font = New Font(Me.lblLectoresOpcion2.Font, FontStyle.Bold)
    End Sub

    Private Sub lblLectoresOpcion3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblLectoresOpcion3.MouseLeave
        Me.lblLectoresOpcion3.ForeColor = Color.White
        Me.lblLectoresOpcion3.Font = New Font(Me.lblLectoresOpcion3.Font, FontStyle.Regular)
    End Sub

    Private Sub lblLectoresOpcion3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblLectoresOpcion3.MouseMove
        Me.lblLectoresOpcion3.ForeColor = Color.Coral
        Me.lblLectoresOpcion3.Font = New Font(Me.lblLectoresOpcion3.Font, FontStyle.Bold)
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub Label1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseLeave
        Me.Label1.ForeColor = Color.White
        Me.Label1.Font = New Font(Me.Label1.Font, FontStyle.Regular)
    End Sub

    Private Sub Label1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseMove
        Me.Label1.ForeColor = Color.Coral
        Me.Label1.Font = New Font(Me.Label1.Font, FontStyle.Bold)
    End Sub

    Private Sub lblCatalogoOpcion1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblCatalogoOpcion1.MouseLeave
        Me.lblCatalogoOpcion1.ForeColor = Color.White
        Me.lblCatalogoOpcion1.Font = New Font(Me.lblCatalogoOpcion1.Font, FontStyle.Regular)
    End Sub

    Private Sub lblCatalogoOpcion1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblCatalogoOpcion1.MouseMove
        Me.lblCatalogoOpcion1.ForeColor = Color.Coral
        Me.lblCatalogoOpcion1.Font = New Font(Me.lblCatalogoOpcion1.Font, FontStyle.Bold)
    End Sub

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub

    Private Sub Label2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label2.MouseLeave
        Me.Label2.ForeColor = Color.White
        Me.Label2.Font = New Font(Me.Label2.Font, FontStyle.Regular)
    End Sub

    Private Sub Label2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label2.MouseMove
        Me.Label2.ForeColor = Color.Coral
        Me.Label2.Font = New Font(Me.Label2.Font, FontStyle.Bold)
    End Sub

    Private Sub GeneroToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GeneroToolStripMenuItem.Click
        FormNuevoGenero.ShowDialog()
    End Sub

    Private Sub AplicacionesPedagogicasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AplicacionesPedagogicasToolStripMenuItem.Click
        FormNuevoApp.ShowDialog()
    End Sub

    Private Sub LenguasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LenguasToolStripMenuItem.Click
        FormNuevoLenguas.ShowDialog()
    End Sub

    Private Sub MateriasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MateriasToolStripMenuItem.Click
        FormNuevoMaterias.ShowDialog()
    End Sub

    Private Sub PaisesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PaisesToolStripMenuItem.Click
        FormNuevoPaises.ShowDialog()
    End Sub

    Private Sub EditorialToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditorialToolStripMenuItem.Click
        FormNuevoEditorial.ShowDialog()
    End Sub

    Private Sub AcercadeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcercadeToolStripMenuItem.Click
        AboutBox.ShowDialog()
    End Sub

    Private Sub lblPrestamoOpcion1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion1.MouseLeave
        Me.lblPrestamoOpcion1.ForeColor = Color.White
        Me.lblPrestamoOpcion1.Font = New Font(Me.lblPrestamoOpcion1.Font, FontStyle.Regular)
    End Sub

    Private Sub lblPrestamoOpcion1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPrestamoOpcion1.MouseMove
        Me.lblPrestamoOpcion1.ForeColor = Color.Coral
        Me.lblPrestamoOpcion1.Font = New Font(Me.lblPrestamoOpcion1.Font, FontStyle.Bold)
    End Sub

    Private Sub lblPrestamoOpcion2_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion2.MouseLeave
        Me.lblPrestamoOpcion2.ForeColor = Color.White
        Me.lblPrestamoOpcion2.Font = New Font(Me.lblPrestamoOpcion2.Font, FontStyle.Regular)
    End Sub

    Private Sub lblPrestamoOpcion2_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPrestamoOpcion2.MouseMove
        Me.lblPrestamoOpcion2.ForeColor = Color.Coral
        Me.lblPrestamoOpcion2.Font = New Font(Me.lblPrestamoOpcion2.Font, FontStyle.Bold)
    End Sub

    Private Sub lblPrestamoOpcion3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion3.MouseLeave
        Me.lblPrestamoOpcion3.ForeColor = Color.White
        Me.lblPrestamoOpcion3.Font = New Font(Me.lblPrestamoOpcion3.Font, FontStyle.Regular)
    End Sub

    Private Sub lblPrestamoOpcion3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPrestamoOpcion3.MouseMove
        Me.lblPrestamoOpcion3.ForeColor = Color.Coral
        Me.lblPrestamoOpcion3.Font = New Font(Me.lblPrestamoOpcion3.Font, FontStyle.Bold)
    End Sub

    Private Sub lblPrestamoOpcion4_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion4.MouseLeave
        Me.lblPrestamoOpcion4.ForeColor = Color.White
        Me.lblPrestamoOpcion4.Font = New Font(Me.lblPrestamoOpcion4.Font, FontStyle.Regular)
    End Sub

    Private Sub lblPrestamoOpcion4_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPrestamoOpcion4.MouseMove
        Me.lblPrestamoOpcion4.ForeColor = Color.Coral
        Me.lblPrestamoOpcion4.Font = New Font(Me.lblPrestamoOpcion4.Font, FontStyle.Bold)
    End Sub

    Private Sub lblPrestamoOpcion5_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles lblPrestamoOpcion5.MouseLeave
        Me.lblPrestamoOpcion5.ForeColor = Color.White
        Me.lblPrestamoOpcion5.Font = New Font(Me.lblPrestamoOpcion5.Font, FontStyle.Regular)
    End Sub

    Private Sub lblPrestamoOpcion5_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblPrestamoOpcion5.MouseMove
        Me.lblPrestamoOpcion5.ForeColor = Color.Coral
        Me.lblPrestamoOpcion5.Font = New Font(Me.lblPrestamoOpcion5.Font, FontStyle.Bold)
    End Sub

    Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click

    End Sub

    Private Sub Label3_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label3.MouseLeave
        Me.Label3.ForeColor = Color.White
        Me.Label3.Font = New Font(Me.Label3.Font, FontStyle.Regular)
    End Sub

    Private Sub Label3_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label3.MouseMove
        Me.Label3.ForeColor = Color.Coral
        Me.Label3.Font = New Font(Me.Label3.Font, FontStyle.Bold)
    End Sub
End Class
